home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16928 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.5 KB  |  130 lines

  1. Path: news.crd.ge.com!rebecca!news
  2. From: Helin Wei <whl@climate.asrc.albany.edu>
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: help about the modification from cc to gcc compiler
  5. Date: Fri, 12 Apr 1996 14:26:03 -0400
  6. Organization: The University at Albany
  7. Message-ID: <316EA03B.28EB@climate.asrc.albany.edu>
  8. NNTP-Posting-Host: csss1.climate.asrc.albany.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=gb2312
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4c)
  13. CC: whl@climate.asrc.albany.edu
  14.  
  15. Hi,
  16.  
  17. Because my Sun Sparc 20 system has been changed to Solaris 2.4 from
  18. Openwindow,I met a problem when I try to use gcc to compile one 
  19. program which can be compiled well by cc compiler,anyone can tell me
  20. what I should modify the program,thanks in advance.Following is the
  21. error message and the code:
  22.  
  23. signal.c: In function `setsig_':
  24. signal.c:17: storage size of `sigsegv' isn't known
  25. signal.c:17: storage size of `sigbus' isn't known
  26. *** Error code 1
  27. The following command caused the error:
  28. gcc -g -Dsun -c -o signal.o signal.c
  29.  
  30.  
  31.  
  32. /*--------------------------------------------------------------------*/
  33.  
  34. #ifdef sun
  35.  
  36. #include <signal.h>
  37. #include <stdio.h>
  38. #define SUN
  39.  
  40. void stopgf_();
  41.  
  42. void setsig_()
  43. {       /*  set up to catch a few signals  */
  44.  
  45. #include <floatingpoint.h>
  46.   void sgsegv(), sgbuserr();
  47.   void sginexact(), sg0div(), sgunder(), sgover(), sginvalid();
  48.   struct sigvec sigsegv, sigbus;
  49.   extern int sigvec(), ieee_handler();
  50.  
  51.   sigsegv.sv_handler = sgsegv;
  52.   sigbus.sv_handler = sgbuserr;
  53.   (void) sigvec(SIGSEGV, &sigsegv, NULL);
  54.   (void) sigvec(SIGBUS, &sigbus, NULL);
  55. /*ieee_handler("set", "inexact", sginexact);*/
  56.   ieee_handler("set", "division", sg0div);
  57.   ieee_handler("set", "underflow", sgunder);
  58.   ieee_handler("set", "overflow", sgover);
  59.   ieee_handler("set", "invalid", sginvalid);
  60.  
  61.  return;
  62. }
  63.  
  64.  
  65. /*  Signal handlers follow  */
  66.  
  67. void sgsegv()
  68. {
  69.   printf("Segmentation violation");
  70.   stopgf_();
  71. }
  72.  
  73.  
  74. void sgbuserr()
  75. {
  76.   printf("Bus error");
  77.   stopgf_();
  78. }
  79.  
  80.  
  81. void sginexact()
  82. {
  83.   printf("Inexact FPE error");
  84.   stopgf_();
  85. }
  86.  
  87.  
  88. void sg0div()
  89. {
  90.   printf("Division by zero FPE error");
  91.   stopgf_();
  92. }
  93.  
  94.  
  95. void sgunder()
  96. {
  97.   printf("Underflow FPE error");
  98.   stopgf_();
  99. }
  100.  void stopgf_()
  101. {
  102.    printf("\nstopgf_() called\n");
  103.    abort();
  104. }
  105.  
  106. #endif
  107.  
  108. /*--------------------------------------------------------------------*/
  109.  
  110. #ifdef sgi
  111.  
  112. void setsig_()
  113. {
  114. }
  115.  
  116. #endif
  117.  
  118. /*--------------------------------------------------------------------*/
  119.  
  120. #ifdef cray
  121.  
  122. void SETSIG()
  123. {
  124. }
  125.  
  126. #endif
  127.  
  128. /*--------------------------------------------------------------------*/
  129. ~
  130.